<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Register extends CI_Controller {

    function __construct() { //import class
        parent::__construct();
        $this->load->helper('form', 'url');
        $this->load->model('leo');
    }

    function index() {
        $this->load->view('template/head');
        $this->load->view('template/header');
        $this->load->view('template/register');
        $this->load->view('template/footer');
    }

    function input() {
        $reg = array(
            'nama' => $this->security->xss_clean($this->input->post('nama')),
            'username' => $this->security->xss_clean($this->input->post('username')),
            'password' => $this->security->xss_clean($this->encrypt->sha1($this->input->post('password'))),
            'previlege_id' => 2,
            'email' => $this->security->xss_clean($this->input->post('email')),
            'phone' => $this->security->xss_clean($this->input->post('telepon')),
            'angkatan_id' => $this->security->xss_clean($this->input->post('angkatan')),
            'jurusan_id' => $this->security->xss_clean($this->input->post('jurusan')),
            'thn_lulus' => $this->security->xss_clean($this->input->post('lulus')),
            'company' => $this->security->xss_clean($this->input->post('kerja')),
            'address_comp' => $this->security->xss_clean($this->input->post('kantor')),
            'city_id' => 1,
            'address_home' => $this->security->xss_clean($this->input->post('rumah')),
            'status_nikah' => $this->security->xss_clean($this->input->post('status'))
        );
        $this->leo->reg_user($reg);
        redirect('register/success');
    }
    
    function success(){
        echo 'Register berhasil <br/>';
        echo anchor('main','Back to main');
    }

}

/* End of file register.php */
/* Location: ./application/controllers/register.php */